package com.mall.business.service;

import java.util.List;
import com.mall.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mall.business.mapper.BusOrderLineMapper;
import com.mall.business.domain.entity.BusOrderLine;
import com.mall.common.core.text.Convert;

/**
 * 订单明细Service业务层处理
 *
 * @author zhonglin
 * @date 2020-05-24
 */
@Service
public class BusOrderLineService {

  @Autowired
  private BusOrderLineMapper busOrderLineMapper;

  /**
   * 查询订单明细
   *
   * @param orderLineId 订单明细ID
   *
   * @return 订单明细
   */
  public BusOrderLine selectBusOrderLineById(Long orderLineId) {

    return busOrderLineMapper.selectBusOrderLineById(orderLineId);
  }

  /**
   * 查询订单明细列表
   *
   * @param busOrderLine 订单明细
   *
   * @return 订单明细
   */
  public List<BusOrderLine> selectBusOrderLineList(BusOrderLine busOrderLine) {

    return busOrderLineMapper.selectBusOrderLineList(busOrderLine);
  }

  /**
   * 新增订单明细
   *
   * @param busOrderLine 订单明细
   *
   * @return 结果
   */
  public int insertBusOrderLine(BusOrderLine busOrderLine) {

    busOrderLine.setCreateTime(DateUtils.getNowDate());
    return busOrderLineMapper.insertBusOrderLine(busOrderLine);
  }

  /**
   * 修改订单明细
   *
   * @param busOrderLine 订单明细
   *
   * @return 结果
   */
  public int updateBusOrderLine(BusOrderLine busOrderLine) {

    busOrderLine.setUpdateTime(DateUtils.getNowDate());
    return busOrderLineMapper.updateBusOrderLine(busOrderLine);
  }

  /**
   * 删除订单明细对象
   *
   * @param ids 需要删除的数据ID
   *
   * @return 结果
   */
  public int deleteBusOrderLineByIds(String ids) {

    return busOrderLineMapper.deleteBusOrderLineByIds(Convert.toStrArray(ids));
  }

  /**
   * 删除订单明细信息
   *
   * @param orderLineId 订单明细ID
   *
   * @return 结果
   */
  public int deleteBusOrderLineById(Long orderLineId) {

    return busOrderLineMapper.deleteBusOrderLineById(orderLineId);
  }

}
